﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RockBus.ServiceBus;
using ConferenceMessages;

namespace ConferenceParticipantUI
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Starting the ConferenceParticipantUI.");

            PublisherClient pc = new PublisherClient();
            pc.ScanAssemblies(typeof(ConferenceInfo).Assembly);

            bool exit = false;
            while (!exit)
            {
                Console.Write("Enter the conference id (any string): ");
                string conferenceIdString = Console.ReadLine();

                Console.Write("Enter the user id (any string): ");
                string userIdString = Console.ReadLine();

                CreateConferenceRequest ccr = new CreateConferenceRequest()
                {
                    ConferenceId = conferenceIdString,
                    UserId = userIdString,
                };

                pc.Publish(ccr);

                Console.WriteLine("Press Enter to try again, any key to exit.");
                string readline = Console.ReadLine();
                exit = (readline.Length > 0);
            }
        }
    }
}
